using STHPMS1.ICore;
using STHPMS1.ICore.I_BLL;
using STHPMS1.ICore.I_Common;
using STHPMS1.ICore.I_Core;
using STHPMS1.ICore.I_DAL;
using STHPMS1.ICore.I_UI;

namespace STHPMS1.Web.W_Core
{
	public class Scene : DisposeObject, IScene
	{
		public Scene ()
		{
			UI = MyApp.Locator.GetInstance<IUIFacade> ();
			Bll = MyApp.Locator.GetInstance<IBllFacade> ();
			Dal = MyApp.Locator.GetInstance<IDalFacade> ();
            Data = MyApp.Locator.GetInstance<IGlobalData>();
			UI.Scene = this;
			Bll.Scene = this;
			Dal.Scene = this;
            IsOpen = true;

		}
        public bool IsOpen {
            get; set; 
        }


		public IContext Context {
			get;
			set;
		}

		public IUIFacade UI {
			get;
			set;
		}

		public IBllFacade Bll {
			get;
			set;
		}

		public IDalFacade Dal {
			get;
			set;
		}

        public IGlobalData Data
        {
            get;
            set;
        }

		protected override void OnDispose ()
		{
			if (UI != null)
				UI.Dispose ();
			if (Bll != null)
				Bll.Dispose ();
			if (Dal != null)
				Dal.Dispose ();
			UI = null;
			Bll = null;
			Dal = null;
            Data = null;
			base.OnDispose ();
		}
    }
}
